UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lk0RIjPxpg+3WlMYdXfj4+szTumGzSw/A/kBPyAIe58='
WHERE
key_id = '7c6aa66356d13748920718f3cb4b0860426030cdbc6f33a6d4daaaa133f5917c'
AND (
token = 'lk0RIjPxpg+3WlMYdXfj4+szTumGzSw/A/kBPyAIe58='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)