UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r5C//gUQb3WObkwuDBYdsaBU6RnYKf5NJdwVPS8101I=' 
WHERE 
  key_id = '12301b36c9b28d005c98bf4ad0b1e3e6c82f90ce6c665bf4f3e19de663609886' 
  AND (
    token = 'r5C//gUQb3WObkwuDBYdsaBU6RnYKf5NJdwVPS8101I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025