UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pwFyGvxmAvuvBrgKbFwDcpN43cn8Ct1ENTxuvtvFQ5w='
WHERE
key_id = '795aac7682a8338e2fa40873b8f4019538e71db8e2acfcd98f3c8cd2586ddb15'
AND (
token = 'pwFyGvxmAvuvBrgKbFwDcpN43cn8Ct1ENTxuvtvFQ5w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)