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