UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DdO2X++sTwUB5V8WtjhxIMDDyjVprU3Vdlir/aQ6cn4='
WHERE
key_id = 'cf78a9458af4b56ab94ba59b538a460abe397f29fb108af6854f82343706c611'
AND (
token = 'DdO2X++sTwUB5V8WtjhxIMDDyjVprU3Vdlir/aQ6cn4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)