UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BsbGYUnm5y03D4gE7gCeD3RKbiddWSdFwZM8xf+C8vk='
WHERE
key_id = 'bcacaa3e049f2104da9d113f48facc2f6a05cec6cb596abec163e06f043336dd'
AND (
token = 'BsbGYUnm5y03D4gE7gCeD3RKbiddWSdFwZM8xf+C8vk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)