UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aLsNNxVk0zMhOpJ+AZEaDd8SZCl212Ib3TLx3yii5g4='
WHERE
key_id = 'd97ea7bd6f91620fc9c5ea11e01656cf97de43d9da48d4dce0b5047947499df0'
AND (
token = 'aLsNNxVk0zMhOpJ+AZEaDd8SZCl212Ib3TLx3yii5g4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)