UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qM63ZtyN/OzFANsO8e5sgybe+ugYk7CEC93QPcSQELA=' 
WHERE 
  key_id = '18f40c86b0426476d27b6907779cc02a58e57ad68a1736eae709e7fc8af49bea' 
  AND (
    token = 'qM63ZtyN/OzFANsO8e5sgybe+ugYk7CEC93QPcSQELA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029