UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'k+x6BJJymaQgpQlwj9/ZT1tPKcpOSCmIsW2QKRFPEG0='
WHERE
key_id = 'c0f91a54fa6b9bc0793840c07eec74ce77b8176a7afda1ad4909fd7fee29ccbb'
AND (
token = 'k+x6BJJymaQgpQlwj9/ZT1tPKcpOSCmIsW2QKRFPEG0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)