UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7vwyO2gq1YIDrehQ4kaLgmB4QHnWWtfTVIWb6XGUPrA='
WHERE
key_id = '6a5eca400f9491a4a983fd3fe83fe987a5f7df00cc938b6ecc4e7b069baa3758'
AND (
token = '7vwyO2gq1YIDrehQ4kaLgmB4QHnWWtfTVIWb6XGUPrA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)