UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X0BSENTK8Vg3lVFbeRBXk5qfl88+uPpBQdrBYjlfwvo=' 
WHERE 
  key_id = '2fc26f564e5cba10c4717eb686a0a5dcb45f26c3579155fe02255f7f0d8c0977' 
  AND (
    token = 'X0BSENTK8Vg3lVFbeRBXk5qfl88+uPpBQdrBYjlfwvo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034