UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Frj1aUDb7KDJ81BGjJJutZwxxWGM83TOKpmFt3d9g6g='
WHERE
key_id = '4e016afe9562ed69a89e5e0164295a91739ee3ddcb29ff9288ad25b0dcda05d5'
AND (
token = 'Frj1aUDb7KDJ81BGjJJutZwxxWGM83TOKpmFt3d9g6g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)