UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XfoGo+2EPZgjkrq33iArsWEUPG24IBxPlZzZ4iNceOk='
WHERE
key_id = '4da208787be9796f23c02a9eaab2d765b51bc72ac779d5893ec205b75d25dbfd'
AND (
token = 'XfoGo+2EPZgjkrq33iArsWEUPG24IBxPlZzZ4iNceOk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)