UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'J9hPzDI673o5wRRl5AN+XMXdTxb8EizEPYBYzBUTbHs='
WHERE
key_id = '594487982e07bc40b8e62763b45820be42b0be858424c1b800d2d20f7582fda7'
AND (
token = 'J9hPzDI673o5wRRl5AN+XMXdTxb8EizEPYBYzBUTbHs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)