UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YwHUdHi7hpdUpaOG6rtdvSS3cPRRHxKeWKmbc8w9OFI='
WHERE
key_id = '5bedbcb76952a98469f731b21e7bc7ba88bb94b2c50e5412ad7434d6374a05f5'
AND (
token = 'YwHUdHi7hpdUpaOG6rtdvSS3cPRRHxKeWKmbc8w9OFI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)