UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JnpeKQuCjoIA1rtrvHwuRtmLo/JphNTP95hJWvogdHc='
WHERE
key_id = 'c0410a79e2c3e0587f11706c92497a09c9c49219a4224c3c3a5abb5e4843b94a'
AND (
token = 'JnpeKQuCjoIA1rtrvHwuRtmLo/JphNTP95hJWvogdHc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)