UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kiaa1BOTXdSXkl26vQsH1eQ4w/RnrQRDa/2ow4409j4=' 
WHERE 
  key_id = 'a81d03b8d57db04c6b87068afce83afcf73403d01f72a91cdce0a920186074d0' 
  AND (
    token = 'kiaa1BOTXdSXkl26vQsH1eQ4w/RnrQRDa/2ow4409j4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045