UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Rfw1S8cX/XXCB/ZMwZBhYjQK3sjvtNw4whtdmLd+kA4=' 
WHERE 
  key_id = '8e5a193c70356beb1035107910f9785a775f9dc79a1ff37c0fc2d4c35452ed22' 
  AND (
    token = 'Rfw1S8cX/XXCB/ZMwZBhYjQK3sjvtNw4whtdmLd+kA4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035