UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AZzH9/bo7LWawKu32AOQQ41BuQygLx3mWwQ4SmsCEwg='
WHERE
key_id = 'd930fa868fca404df63b667d6eb9905fb27cd3c9774510df8961062fa665297b'
AND (
token = 'AZzH9/bo7LWawKu32AOQQ41BuQygLx3mWwQ4SmsCEwg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)