UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sZWSs0K5y6r3gTnVw0CMBlIG6uglGMDZmPg2YvMM7Pk=' 
WHERE 
  key_id = '666a60a2e9f10951805fffba5c82b739082e41408d8a281a2123b50cf5b9e04f' 
  AND (
    token = 'sZWSs0K5y6r3gTnVw0CMBlIG6uglGMDZmPg2YvMM7Pk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026