UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ols9IjueWkQ2Lsik5qZt52ncGhoRCdOPxt3Hj8Glj2I='
WHERE
key_id = 'ccbe2eaef791b77e99220a9ca000cffdf1c56b9e9e03c87a4d86631ea73e9df3'
AND (
token = 'ols9IjueWkQ2Lsik5qZt52ncGhoRCdOPxt3Hj8Glj2I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)