UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'K4btYW3Iyatc32VhmAMjIdyDSgmEUPFSUQuf3VDMQmk='
WHERE
key_id = '83959eecd2c46a6dbbf91af87cebf78e43ca5ecbc37a14e814810ee4498ef874'
AND (
token = 'K4btYW3Iyatc32VhmAMjIdyDSgmEUPFSUQuf3VDMQmk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)