UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RORkBLFOs44R56JPijYsJxsJzZ5nGUTfFobCVksphYs=' 
WHERE 
  key_id = 'f458af5b417d3c1750ee2f493192cdf6264fbc0ef10643b78c816473f8bfd16f' 
  AND (
    token = 'RORkBLFOs44R56JPijYsJxsJzZ5nGUTfFobCVksphYs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028