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