UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'liWn6sv6SG+HvIjMwUykqwg7tOaMIapdfOD17r83LLA='
WHERE
key_id = '37a479ecfb8a7698e42c11f6b292c9b7218ab92796432dac31f51acd525de4c3'
AND (
token = 'liWn6sv6SG+HvIjMwUykqwg7tOaMIapdfOD17r83LLA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)