UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o8NdO36bPpcT02DjKn/aiLl12FgXYNJOQ7+Ka8EzVt4=' 
WHERE 
  key_id = '42538253523d13709e58e197c4ef815df7c71816e087f61c9aab3c67decd057e' 
  AND (
    token = 'o8NdO36bPpcT02DjKn/aiLl12FgXYNJOQ7+Ka8EzVt4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025