UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zQKLqDswMeDgv7+lY1sosJ8VgkaJM3GSz+DfyOZLe4M=' 
WHERE 
  key_id = '15ddf2386329b66d0081bfc9d5ddef74d7b3b51a79859aceadc7b5d2d648c0b2' 
  AND (
    token = 'zQKLqDswMeDgv7+lY1sosJ8VgkaJM3GSz+DfyOZLe4M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028