UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S5Fx5O0T63xlvX9zZVzFtHuo6A5EBsYJNTbgk7Y1xe0=' 
WHERE 
  key_id = '33ec442e8a17267a35e4b22d98d16d6c1e81425a1f95dff13d4605426c5b2807' 
  AND (
    token = 'S5Fx5O0T63xlvX9zZVzFtHuo6A5EBsYJNTbgk7Y1xe0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022