UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sXF0rgTVSNDJiR+tN0szB6Hu7Gma4rlyVDpe0vdOjxU=' 
WHERE 
  key_id = '428a7bc5c9a5adeec658f14d8647cf7111d8d2f69c37e3fdfc0794cd23ec9301' 
  AND (
    token = 'sXF0rgTVSNDJiR+tN0szB6Hu7Gma4rlyVDpe0vdOjxU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039