UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ca9un81IHRHI1WxIgeRLFGISXiW++3t2FmpNFJvG4AI='
WHERE
key_id = 'a87d3dbe99e550346ef92047a37aa4495ec827f7a69fa533960fefd6b9d0779f'
AND (
token = 'Ca9un81IHRHI1WxIgeRLFGISXiW++3t2FmpNFJvG4AI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)