UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wF5Glldr5oHywf2+K4FF/AABZvzljj3UiF11RXsnLDA=' 
WHERE 
  key_id = 'dccc344eb967278375ef402cb96c9a0d4520b4d7b359a5b51635732578ed5f66' 
  AND (
    token = 'wF5Glldr5oHywf2+K4FF/AABZvzljj3UiF11RXsnLDA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051