UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8wCSPrWJhdDa3xknSzwJG61aV4IPHadmfnmocPVFrYc='
WHERE
key_id = 'b771b3e54928763f25008da638ebbfebe6f34ab761da7d316d0ed4a7482c9a3e'
AND (
token = '8wCSPrWJhdDa3xknSzwJG61aV4IPHadmfnmocPVFrYc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)