UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jiUanM1eyj5n7uCypEDtiSgUOb41mDRBkZr43fvbXR4='
WHERE
key_id = 'a4895ca910acc5c154d6cfb306ac77881350d41923f7d97a94111a924d61a62b'
AND (
token = 'jiUanM1eyj5n7uCypEDtiSgUOb41mDRBkZr43fvbXR4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)