UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JCVhF9jN5Pj+1XOUfFNEitK4aaEdfrR8Od+1WBnJynA=' 
WHERE 
  key_id = '6f6e62996e5e3fc958a89c1bbfb2c3699bcfa3c00f06196965c86085f7592e13' 
  AND (
    token = 'JCVhF9jN5Pj+1XOUfFNEitK4aaEdfrR8Od+1WBnJynA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051