UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'toGi23qKI+as7PQ6aofEszDQZzOFAkRhZ9ELR5p2JGM=' 
WHERE 
  key_id = '6c4a350e14f555d68f9a2207b05cdc76afbca2de52972364448365abfbff99dc' 
  AND (
    token = 'toGi23qKI+as7PQ6aofEszDQZzOFAkRhZ9ELR5p2JGM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029