UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XvKbsLBQw4yaEkFnCgIIhz4NlSz43HsyShCgA2xzO3o='
WHERE
key_id = '513dd9a92b1c6a298d2af42d4d94bc0a5d019f06003f4dfb1c52471daaa8c7aa'
AND (
token = 'XvKbsLBQw4yaEkFnCgIIhz4NlSz43HsyShCgA2xzO3o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)