UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BkL4vEf8xdjd6XmfZzqUFXgroeMmeE8SfBctd2Yt82g='
WHERE
key_id = '9bf7177286f846506f71a4401da89323824b45c363c89632b09864ac462fedda'
AND (
token = 'BkL4vEf8xdjd6XmfZzqUFXgroeMmeE8SfBctd2Yt82g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)