UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LBhS4c5qwi8raGSq1w9fhzagiCLNgrD7K9eNUdN6j0U='
WHERE
key_id = '0cc17c2c5f4fbba88eb90a568b75b50dab694ece776a9403b44c63bb71a42487'
AND (
token = 'LBhS4c5qwi8raGSq1w9fhzagiCLNgrD7K9eNUdN6j0U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)