UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Htnw1G9HHcI5poVzNPNT096Fx2k3cDvLvULi1osJs+I='
WHERE
key_id = 'aa688a9e110e6752d0682e0fe77bd8264d42390892fccf6190d38bcb9f7c3f8a'
AND (
token = 'Htnw1G9HHcI5poVzNPNT096Fx2k3cDvLvULi1osJs+I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)