UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OtqUkxu809jJdnFx7NjXM9aBvGHh7onnSEuE9XOZ4uk='
WHERE
key_id = '4f6165f95fdcd5823799d64111083223b086c38ddc6c303b12c0442e08ccfb94'
AND (
token = 'OtqUkxu809jJdnFx7NjXM9aBvGHh7onnSEuE9XOZ4uk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)