UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SY+fkL/oa/d1CBXzmQE4De1ZSltcIMrTlqRl0LB+vUQ=' 
WHERE 
  key_id = '42d83a72f60a07e4bf53d647a48cd78c912bc7b26a720baee8cbf568bd80fe98' 
  AND (
    token = 'SY+fkL/oa/d1CBXzmQE4De1ZSltcIMrTlqRl0LB+vUQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037