UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NCS7KjxYwWELBtqiPV+lYDF0LaXC9jTNgW2Ahoous1U=' 
WHERE 
  key_id = 'ce658a74ed367d382050b2bff14f6cc49a7938210a19b1de5c0402045ed62635' 
  AND (
    token = 'NCS7KjxYwWELBtqiPV+lYDF0LaXC9jTNgW2Ahoous1U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023