UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vjPqCEUtZgBPuirdcL2kPFwEvAtgC6+sJiCz5Nq9/uQ=' 
WHERE 
  key_id = '1e12ee250c1236932285e4af55f41a38e245a4b1b0dba9d120930e192b494aae' 
  AND (
    token = 'vjPqCEUtZgBPuirdcL2kPFwEvAtgC6+sJiCz5Nq9/uQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038