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