UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CDdAVL8y4MaDC05h2aScrF42C/e5yxZP8aBmYjvc6vE=' 
WHERE 
  key_id = '347b612cbcc59cc5214b7b41cba6955484530bbaec9f7ba64ab584c0778f956a' 
  AND (
    token = 'CDdAVL8y4MaDC05h2aScrF42C/e5yxZP8aBmYjvc6vE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015