UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'foDqWeIsB/icnff+/yTLpDpDKWdM0D/R14pDw9NCStQ='
WHERE
key_id = '77e31639b0dfe51ec311294ea8a14f39022e70538455fbfafcab6598d407c846'
AND (
token = 'foDqWeIsB/icnff+/yTLpDpDKWdM0D/R14pDw9NCStQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)