UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SJ6XYHpXhpZF68I3CCfyf+81OHv2NADXUn2T1uGeoRA='
WHERE
key_id = 'e7783b1444a07015ad1738941c8f8177946effce210ad3ff67f0764488c9376a'
AND (
token = 'SJ6XYHpXhpZF68I3CCfyf+81OHv2NADXUn2T1uGeoRA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)