UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'f9m/F6jEkAMsEjF8CRQLCIyaqS8jyl8KFGD639RApF0='
WHERE
key_id = '97ec6b3abd87f83913ea56356667fc1b00d95435e41b7bf9c6c71566eb662900'
AND (
token = 'f9m/F6jEkAMsEjF8CRQLCIyaqS8jyl8KFGD639RApF0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)