UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BgXzcX0fu8LpX4g/qRiSFmdl4vulg+6p/vJsB22GuNY='
WHERE
key_id = 'e22fdcadb036dc476b88c7e882ceae949642cbf648ae3be3c119791f218c5651'
AND (
token = 'BgXzcX0fu8LpX4g/qRiSFmdl4vulg+6p/vJsB22GuNY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)