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