UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TjCThsYvafySXNZ9lzLLYOZ2cNjbRl0AzdMYzpuEqU0='
WHERE
key_id = 'fb3683f9d005ca907b47c65b756d6bd7ada3bf5d764c78ed88389daa124832fd'
AND (
token = 'TjCThsYvafySXNZ9lzLLYOZ2cNjbRl0AzdMYzpuEqU0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)