UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7FhhPlmEpaC0kI2nsSEC8MMQ8Q3FjT5tn2rl3knhFzs=' 
WHERE 
  key_id = '54e2194980eb5afe44019648c818f460597a79879e066b945d1a9786c38188cf' 
  AND (
    token = '7FhhPlmEpaC0kI2nsSEC8MMQ8Q3FjT5tn2rl3knhFzs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044